//
//  YSPopupMenu.h
//  YSKitExample
//
//  Created by Kyson on 2017/6/16.
//  Copyright © 2017年 YangShen. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, YSPopupMenuType) {
    YSPopupMenuTypeDefault,
    YSPopupMenuTypeDark
};

@class YSPopupMenu;
@protocol YSPopupMenuDelegate <NSObject>
@optional
- (void)popupMenu:(YSPopupMenu *)popupMenu didSelectIndex:(NSInteger)index;
@end

@interface YSPopupMenu : UIView

/// 圆角半径 Default is 5.0
@property (nonatomic, assign) CGFloat cornerRadius;
/// 是否显示阴影 Default is YES
@property (nonatomic, assign) BOOL isShowShadow;
/// 设置字体大小 Default is 15.0
@property (nonatomic, assign) CGFloat fontSize;
/// 设置字体颜色 默认 Black
@property (nonatomic, strong) UIColor * textColor;
/// 设置偏移距离 (>= 0) Default is 0.0
@property (nonatomic, assign) CGFloat offset;
/// 设置显示模式 Default is SYPopupMenuTypeDefault
@property (nonatomic, assign) YSPopupMenuType type;

@property (nonatomic, weak) id <YSPopupMenuDelegate> delegate;

/**
 初始化popupMenu
 
 @param titles    标题数组
 @param icons     图标数组
 @param itemWidth 菜单宽度
 @param delegate  代理
 */
- (instancetype)initWithTitles:(NSArray *)titles
                         icons:(NSArray *)icons
                     menuWidth:(CGFloat)itemWidth
                      delegate:(id<YSPopupMenuDelegate>)delegate;


/**
 在指定位置弹出类方法
 */
+ (instancetype)showAtPoint:(CGPoint)point
                     titles:(NSArray *)titles
                      icons:(NSArray *)icons
                  menuWidth:(CGFloat)itemWidth
                   delegate:(id<YSPopupMenuDelegate>)delegate;


/**
 依赖指定view弹出类方法
 */
+ (instancetype)showRelyOnView:(UIView *)view
                        titles:(NSArray *)titles
                         icons:(NSArray *)icons
                     menuWidth:(CGFloat)itemWidth
                      delegate:(id<YSPopupMenuDelegate>)delegate;


/**
 在指定位置弹出
 
 @param point 需要弹出的point
 */
- (void)showAtPoint:(CGPoint)point;

/**
 依赖指定view弹出
 
 @param view 需要依赖的view
 */
- (void)showRelyOnView:(UIView *)view;

/**
 消失
 */
- (void)dismiss;

@end
